/*
 * MouseFilterEvents.h
 *
 *  Created on: Apr 29, 2010
 *      Author: pannay
 */

#ifndef MOUSEFILTEREVENTS_H_
#define MOUSEFILTEREVENTS_H_

#include<QObject>
#include<QMouseEvent>
#include "QTAvkonView.h"

const int minMouseMove = 5;
class QMouseFilterEvents : public QObject
	{
public:
	/*
	 * Possonble directions for animation
	 */
	enum t_direction
		{
		LEFT2RIGHT, RIGHT2LEFT, TOP2BOTTOM, BOTTOM2TOP, AUTOMATIC
		};
	/*
	 *  The gestureButton controls which mouse button
	 *  that has to be pressed during the mouse gesture.
	 *  Notice that this all events for this button are
	 *  swallowed by the filter.
	 */
	QMouseFilterEvents(QObject *parent = 0, Qt::MouseButton gestureButton =
			Qt::LeftButton);
	//destructor
	~QMouseFilterEvents();
	/* 
	 * The GestureDirection method findouts the direction in which 
	 * the slide should happen weather in vertical or horizontal.
	 * 
	 */
	void GestureDirection();
	/*
	 * The Animation / Page Change API
	 */
	void NslideInPrev();
	void NslideInNext();
	/*
	 * the setVertical sets vertial Mode which is useful
	 * in finding the direction on the animation
	 */
	void setVertical(bool vertical);

protected:
	
	bool eventFilter(QObject *obj, QEvent *event);

private:

	bool mouseButtonPressEvent(QObject *obj, QMouseEvent *event);
	bool mouseButtonReleaseEvent(QObject *obj, QMouseEvent *event);
	bool mouseMoveEvent(QObject *obj, QMouseEvent *event);
	int xstart;
	int ystart;
	int xEnd;
	int yEnd;
	bool verMode;
	QTAvkonView* m_parent;
	int mouseMoveCount;

	};
#endif /* MOUSEFILTEREVENTS_H_ */
